<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // const Person = {
        //     name: 'Allen',
        //     sayHello: function() {
        //         setTimeout(()=>{
        //             console.log(`hello ${this.name}`);
        //         },1000)
        //     }
        // }
        
        // bind
        const Person = {
            name: 'Allen',
            sayHello: function() {
                setTimeout(function(){
                    console.log(`hello ${this.name}`);
                }.bind(this),1000)
            }
        }
        Person.sayHello();
    </script>
</body>

</html>